/*****************************************************************
**                                                              **
**  Copyright (C) 2004 Amlogic,Inc.                             **
**  All rights reserved                                         **
**        Revision : 1.0                                        **
**                                                              **
*****************************************************************/
#include "includes.h"
#include "aw_windows.h"
#include <chipsupport.h>
#include "app.h"
#include "../user.h"
#include "menu.h"
#include "resource/string_dat.h"
#include "txt_app.h"
#include "img_upgrade.h"
#include "filelistEvent.h"
#include "aw_init_display.h"
#include "aw_TXT_app.h"
#include "aw_sys_app.h"
#include "aw_gui_app.h"
#include "aw_config.h"








// flag 0 or 1 ,0: play txt file  1:image upgrade
// line_interrupt the txt show line number (if image upgrade mode,1 close interrupt  0 don't close interrupt)
// wide the txt show char numbers of one line
#include "upgrade_img.h"
extern SystemDescription system_desc;

//static unsigned percent_process;

static unsigned upgrade_callback(UpgradeProcessInfo a , unsigned para,unsigned para2)
{
//  percent_process=para;
  
  switch(a)
  {
  default:
    while(1)
      ;
    break;
  case UPGRADE_CHECK_OK :
    //                strcpy(UpgradeInfo, "right img file") ;
    FLUpdateUpgradeControl(0) ;
    break;
  case UPGRADING:

    FLUpdateUpgradeControl(1) ;
    break;
  case UPGRADE_FINISHED :
    ClearParaInit();
    FLUpdateUpgradeControl(2) ;
    chip_power_on(1);
    break;
  }

  AVTimeDly(100) ;
}



int PlayTxtFile_nand(char *file_name, INT8U flag, INT16U line_interrupt, INT16U wide)
{
  system_desc.callback=upgrade_callback;
  upgrade_image_file(&system_desc,file_name,0);

  return 1;
}











